package com.gzy.xuexiziliao.controller;


import com.gzy.xuexiziliao.common.result.Result;
import com.gzy.xuexiziliao.pojo.entity.AllReport;
import com.gzy.xuexiziliao.service.RePortService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 *统计控制器
 */
@RestController
@RequestMapping("/admin/report")
@Slf4j
public class RePortController {
    @Autowired
    private RePortService rePortService;

    // 学生统计
    @GetMapping("/StudentStatistics")
    public Result<AllReport> StudentStatistics(
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end){
        log.info("学生统计:{},{}",begin,end);
        return Result.success(rePortService.StudenStatistics(begin,end));
    }

    //医生统计
    @GetMapping("/DoctorStatistics")
    public Result<AllReport> DoctorStatistics(
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end){
        log.info("学生统计:{},{}",begin,end);
        return Result.success(rePortService.DoctorStatistics(begin,end));
    }

}
